<%@ taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>玉灵 QQ:7031633 Email:webrx@126.com</title>
</head>

<body>
<sql:setDataSource var="ds" driver="com.mysql.cj.jdbc.Driver" password="" url="jdbc:mysql://localhost:3306/db" user="root"/>
<sql:query var="version" dataSource="${ds}" sql="select version()"></sql:query>
<c:forEach items="${version.rows}" var="rows">
    <p>${rows['version()']}</p>
</c:forEach>

<c:forEach items="${version.rowsByIndex}" var="rows">
    <p>${rows[0]}</p>
</c:forEach>

<sql:query var="sts" dataSource="${ds}" sql="select name from t_student"/>
<c:forEach items="${sts.rows}" var="st">
    <p>${st.name}</p>
</c:forEach>
</body>
</html>
